﻿@using HouseOfMystery.Models;
@using HouseOfMystery.Helpers;

@{
    ViewBag.Title = "House of Mystery";
}

@model UserState

<div class="content-wrapper main-content">
  @*  <img style="" src="~/Content/Images/key.png" onclick="collectKey()" />*@

    @for (int i = 1; i <= 3; i++)
    {
        // door number
        <span id="doorNum_@i" class="doorNum">@i</span>
   
        // door
        <span id="doorToOpen_@i">
            @if (!Model.Rooms.ElementAtOrDefault(i).IsOpen)
            {
                <a href="/Room/OpenRoom/@i" data-ajax="true">
                    <img id='door_@i' src="../../Content/Images/Home/door.jpg" /></a>
            }
            else
            {
                <a href="/Room/OpenRoom/@i" data-ajax="false">
                    <img id='door_@i' src="../../Content/Images/Home/door.jpg" /></a>
            }
        </span>
    
            // lock
            if (!Model.Rooms.ElementAtOrDefault(i).IsOpen)
            {
        @Ajax.ActionImageLink("../../Content/Images/Home/lock.png", "lock", "lock_" + @i, "openLock(" + @i + ", '" + @GlobalVars.SelectedItem + "')", "OpenLock", "Room", new { Id = i }, null)
            }
            else
            {
        <img class="lock" id='lock@i' src="../../Content/Images/Home/lock.png" style="visibility: hidden" />            
            }
    }
</div>

@if (Model.Items.ElementAtOrDefault(1).Name != "roomkey_1" && Model.Rooms.ElementAtOrDefault(1).IsOpen != true)
{    
   @*first key*@
   @Ajax.ActionImageLink("../../Content/Images/key.png", null, "firstKey", "collectFirstKey()", "CollectFirstKey", "Home", null, null)
}


@*item container*@
<footer style="margin-left: 175px">
    <div id="itemContainer">
        @for (int i = 1; i <= 9; i++)
        {
            @*<div id="item_@i" style="background-image:url(../../Content/Images/item.png); width:100px; height:105px; float:left; line-height:142px;" onclick="selectItem(@i)">

            </div>      *@
            
           @Ajax.ActionDivLink("background-image:url(../../Content/Images/item.png); width:100px; height:105px; float:left; line-height:142px;", null, "item_" + @i, "selectItem("+@i+")", "SelectItem", "Home", new { Id = @i }, null)
      
        }
    </div>
</footer>

